#include "ThreadPool.hpp"
#include "Task.hpp"
#include <unistd.h>

int main()
{

    ThreadPool<Task> *pool = new ThreadPool<Task>();
    // std::unique_ptr<ThreadPool<int>> tp(new ThreadPool<int>());
    pool->Start();

    srand((uint64_t)time(nullptr) ^ getpid());
    // 循环添加任务
    while (1)
    {
        int x = rand() % 100 + 1;
        usleep(1000);
        int y = rand() % 200;

        usleep(1000);
        char oper = opers[rand() % opers.size()];

        Task t(x, y, oper);
        int i = 20;
        while (i--)
        {
            if (i % 2 == 0)
            {
                pool->Push(t);
                pool->Push(t);
                pool->Push(t);
                pool->Push(t);
            }
        }
    }
    pool->Wait();
}